
#include "RibbonStyleOperation.hpp"
#include "../OLApp/CommandsManager.hpp"
#include "../OLCommands/RibbonStyleCommands.hpp"
#include "../OLApp/AppLogger.hpp"

namespace NSOperation {

	RibbonStyleOperation::RibbonStyleOperation() :
		NSCore::AbstractOperation()
	{


	}

	RibbonStyleOperation::~RibbonStyleOperation() {

	}



	void RibbonStyleOperation::actionFileOpenSlot(QString file) {
		NSCommands::FileOpenCommand* cmd = new NSCommands::FileOpenCommand(file);
		myManager(CommandsManager)->execute(cmd);
		
	}



	void RibbonStyleOperation::actionAppCloseSlot(bool checked) {
		NSCommands::AppCloseCommand* cmd = new NSCommands::AppCloseCommand;
		myManager(CommandsManager)->execute(cmd, false);

	}


	void RibbonStyleOperation::actionAppHelpSlot(bool checked) {
		NSCommands::AppHelpCommand* cmd = new NSCommands::AppHelpCommand;
		myManager(CommandsManager)->execute(cmd);

	}


	void RibbonStyleOperation::actionNewRendererSlot() {
		NSCommands::NewRendererCommand* cmd = new NSCommands::NewRendererCommand;
		myManager(CommandsManager)->execute(cmd);

	}


	void RibbonStyleOperation::actionDrawSketchSlot(QAction* action) {
		NSCommands::DrawSketchCommand* cmd = new NSCommands::DrawSketchCommand(action);
		myManager(CommandsManager)->execute(cmd);

	}

	void RibbonStyleOperation::actionAppRedoSlot() {
		bool can_redo = myManager(CommandsManager)->canRedo();
		if (can_redo) {
			myManager(CommandsManager)->redo(); 
		}

	}

	void RibbonStyleOperation::actionAppUndoSlot() {
		bool can_undo = myManager(CommandsManager)->canUndo();
		if (can_undo) {
			myManager(CommandsManager)->undo();
		}

	}


	void RibbonStyleOperation::actionDistanceForPointsSlot(QAction* action) {

	}

	void RibbonStyleOperation::actionDistanceForElemtsSlot(QAction* action) {


	}

	void RibbonStyleOperation::actionMyToolsSlot(QAction* action) {
		logsuccess(QString("%1 ($40RMB.)-amxyby (vx)").arg(action->text()));

	}


	void RibbonStyleOperation::actionSetWorkpathSlot(QString dir) {
		NSCommands::SetWorkpathCommand* cmd = new NSCommands::SetWorkpathCommand(dir);
		myManager(CommandsManager)->execute(cmd, false);

	}


	void RibbonStyleOperation::actionAppPrinterSlot() {
		NSCommands::AppPrinterCommand* cmd = new NSCommands::AppPrinterCommand;
		myManager(CommandsManager)->execute(cmd, false);
	}


	void RibbonStyleOperation::actionModelNewSlot(QString name) {
		NSCommands::ModelNewCommand* cmd = new NSCommands::ModelNewCommand(name);
		myManager(CommandsManager)->execute(cmd);

	}


	void RibbonStyleOperation::actionGeomPointOpenSlot(QString name) {
		NSCommands::GPOpenCommand* cmd = new NSCommands::GPOpenCommand(name);
		myManager(CommandsManager)->execute(cmd);

	}


}